<?php

namespace app\index\controller;

use think\Controller;
use think\Request;
use app\index\model\Question as QuestionModel;

class Question extends BaseController
{
    /**
     * 问题列表
     */
    public function lists()
    {
        $size = $this->request->get('size');
        $qeustion = QuestionModel::lists($size);
        $qeustion->total() ? $this->successes([
            'items' => $qeustion->items(),
            'total' => $qeustion->total()
        ]) : $this->errorMsg('暂无数据');
    }

    /**
     * 问题详情
     */
    public function detail()
    {
        $qeustionId = $this->notEmpty('question_id');
        $qeustion = QuestionModel::find($qeustionId);
        $this->successes(compact('qeustion'));
    }
}
